using System;
using System.Linq;
using Blog.DAL;
using Blog.Models;

namespace Blog.Util
{
    public static class DbInitializer
    {
        public static void Initialize(BloggingContext context)
        {
            context.Database.EnsureCreated();

            // Look for any students.
            if (context.Accounts.Any())
            {
                return;   // DB has been seeded
            }

            var students = new Account[]
            {
            new Account{UserName="Carson",CreateTime=DateTime.Now},
            new Account{UserName="Meredith",CreateTime=DateTime.Now}
         };
            foreach (Account s in students)
            {
                context.Accounts.Add(s);
            }
            context.SaveChanges();

        }
    }
}